package com.demo.spring.aware;

import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

@Component
@PropertySource({"classpath:/db.properties"})
public class MyEnvironmentAware implements EnvironmentAware {

	@Override
	public void setEnvironment(Environment environment) {
		System.out.println("set environment: " + environment);
		System.out.println("JAVA_HOME: " + environment.getProperty("JAVA_HOME"));
		System.out.println("jdbc.driver: " + environment.getProperty("jdbc.driver"));
	}

}